home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / UTCUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  2.7 KB  |  131 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        UTCUtils.h
  3.  
  4.      Contains:    Interface for UTC to Local Time conversion and 64 Bit Clock routines
  5.  
  6.      Version:    Technology:    Mac OS 9
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __UTCUTILS__
  18. #define __UTCUTILS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __MACERRORS__
  25.     #include <MacErrors.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. /* Options for Set & Get DateTime Routines */
  52. enum {
  53.     kUTCDefaultOptions            = 0
  54. };
  55.  
  56. /* 64 Bit Clock Typedefs */
  57.  
  58. struct UTCDateTime {
  59.     UInt16                             highSeconds;
  60.     UInt32                             lowSeconds;
  61.     UInt16                             fraction;
  62. };
  63. typedef struct UTCDateTime                UTCDateTime;
  64. typedef UTCDateTime *                    UTCDateTimePtr;
  65. typedef UTCDateTimePtr *                UTCDateTimeHandle;
  66.  
  67. struct LocalDateTime {
  68.     UInt16                             highSeconds;
  69.     UInt32                             lowSeconds;
  70.     UInt16                             fraction;
  71. };
  72. typedef struct LocalDateTime            LocalDateTime;
  73. typedef LocalDateTime *                    LocalDateTimePtr;
  74. typedef LocalDateTimePtr *                LocalDateTimeHandle;
  75. /* Classic 32 bit clock conversion routines */
  76. EXTERN_API_C( OSStatus )
  77. ConvertLocalTimeToUTC            (UInt32                 localSeconds,
  78.                                  UInt32 *                utcSeconds);
  79.  
  80. EXTERN_API_C( OSStatus )
  81. ConvertUTCToLocalTime            (UInt32                 utcSeconds,
  82.                                  UInt32 *                localSeconds);
  83.  
  84. /* 64 bit clock conversion routines */
  85. EXTERN_API_C( OSStatus )
  86. ConvertUTCToLocalDateTime        (const UTCDateTime *    utcDateTime,
  87.                                  LocalDateTime *        localDateTime);
  88.  
  89. EXTERN_API_C( OSStatus )
  90. ConvertLocalToUTCDateTime        (const LocalDateTime *    localDateTime,
  91.                                  UTCDateTime *            utcDateTime);
  92.  
  93. /* Getter and Setter Clock routines using 64 Bit values */
  94. EXTERN_API_C( OSStatus )
  95. GetUTCDateTime                    (UTCDateTime *            utcDateTime,
  96.                                  OptionBits             options);
  97.  
  98. EXTERN_API_C( OSStatus )
  99. SetUTCDateTime                    (const UTCDateTime *    utcDateTime,
  100.                                  OptionBits             options);
  101.  
  102. EXTERN_API_C( OSStatus )
  103. GetLocalDateTime                (LocalDateTime *        localDateTime,
  104.                                  OptionBits             options);
  105.  
  106. EXTERN_API_C( OSStatus )
  107. SetLocalDateTime                (const LocalDateTime *    localDateTime,
  108.                                  OptionBits             options);
  109.  
  110.  
  111. #if PRAGMA_STRUCT_ALIGN
  112.     #pragma options align=reset
  113. #elif PRAGMA_STRUCT_PACKPUSH
  114.     #pragma pack(pop)
  115. #elif PRAGMA_STRUCT_PACK
  116.     #pragma pack()
  117. #endif
  118.  
  119. #ifdef PRAGMA_IMPORT_OFF
  120. #pragma import off
  121. #elif PRAGMA_IMPORT
  122. #pragma import reset
  123. #endif
  124.  
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128.  
  129. #endif /* __UTCUTILS__ */
  130.  
  131.